<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'register.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

<script type="text/javascript" src="script/jquery-1.8.2.js"></script>

<script type="text/javascript">
	$(function() {
		$("#button1").click(function() {
			$.ajax({
				type : "post",
				url : "checkUsername.action",
				dataType : "html",
				data : 
				{
					username : $("#username").val()
				},
				success : function(returnedData) 
				{
					alert(returnedData);
				}
			});
		});
	});

	$(function() {
		$("#button2").click(function() {
			var username = $("#username");
			var password = $("#password");
			var repassword = $("#repassword");
			if (password.val() == "" && repassword.val() == "") {
				alert("密码不能为空！");
				return false;
			} else if (password.val() != repassword.val()) {
				alert("密码不一致！");
				return false;
			} else if (username.val() == null) {
				alert("用户名不能为空！");
				return false;
			}
			return true;
		});
	});
</script>

</head>

<body bgcolor="pink">

	<h2 align="center">
		<dd>用户注册</dd>
	</h2>
	<p align="center">..............................致...我...们...终...将...逝...去...的...青...春...............................</p>
	<form action="addUser.action" method="post">
		<table border="0" align="center">
		
			<tr><td align="center">登陆帐号：</td><td><input name="username" type="text" id="username" /> *<span><input type="button" value="检查是否已被占用" id="button1"> </span></td></tr>
		    <tr><td align="center">登陆密码：</td><td><input name="password" type="password" id="password" /> *</td></tr>
			<tr><td align="center">重复密码：</td><td> <input name="repassword" type="password" id="repassword" /></td></tr>
			<tr><td ><input type="submit" name="Submit2" value="注册" id="button2" /></td><td><input type="reset" name="Submit22" value="重 置"></td></tr>
		
		</table>	
	</form>
    
</body>
</html>
